const state = {
  userInfo: {
    name: '张三',
    age: 18
  }
}
const getters = {
  getFirstNmae (state) {
    return state.userInfo.name.slice(0, 1)
  }
}
const mutations = {
  changeName (state, name) {
    state.userInfo.name = name
  }
}
const actions = {
  chanageNameAsync (store, name) {
    setTimeout(() => {
      store.commit('changeName', name)
    }, 1000)
  }
}
export default {
  namespaced: true,
  state,
  getters,
  mutations,
  actions
}
